#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h> 
#include <unistd.h>
#include<errno.h>

extern int errno;

int main(void)
{
    char buf [20] ="2020/2/14";
    int fd = 0;
    int rc =0;
    //fd = open("/dev/zck_class/dev",O_RDWR | O_NOCTTY | O_NDELAY);
  // fd = open("/dev/zck_class",O_RDONLY);
  fd = open("/dev/sys_class_dname",O_RDWR);
 //fd = open("/sys/class/sys_class_name/sys_class_dname/dev",O_RDWR);          //error cant thought this path
    printf("fd = %d \n",fd);
    if((-1) == fd)
    {
        printf("open failed\n");
        printf("errno=%d\n",errno);
    }
    rc = write(fd,buf,15);
    if((-1) == rc)
    {
        printf("user_write failed\n");
        printf("errno=%d\n",errno);
    }
    rc = read(fd,buf,15);
     if((-1) == rc)
    {
        printf("user_read failed\n");
        printf("errno=%d\n",errno);
    }

    close(fd);
    printf("over all\n");
    return 0;
}